module factorial_demo(
    input Clk,
	 input[3:0] N,      
    output reg[31:0] Result 
);

integer i;

	always @(posedge Clk) begin
		Result = 1;
		if (N == 0) begin
			Result = 1;
		end 
		else begin
			for (i = 1; i <= N; i = i + 1) begin
				Result = Result * i;
			end
		end
	end

endmodule
